// 工厂模式创建对象，减少重复代码-减少很多new。。。但是不容易看出来原型是什么，得手动获取
function createPerson(name, age, job) {
  var o = new Array()
  o.length = 1033333333333
  o[1] = 1
  o.say = function () {
    return Object.prototype.toString.call(this)
  }
  return o
}
var arr1 = createPerson()
console.log(arr1) // (10) [empty, 1, empty × 8, say: ƒ]
console.log(arr1.say()) // [object Array]
console.log(arr1.__proto__) 

// 构造函数
function Person (name, age, job) {
  this.name = name
  this.age = age
  this.job = job
  this.sayName = function () {
    return this.name
  }
}
var person = new Person ('Nicholas', 29, 'Software Engineer')
var person2 = new Person ('Nicholas', 29, 'Software Engineer')
console.log(person == person2) // false
person.valueOf = function () {
  return 2 // 比较大小的时候比较的是对象的valueOf方法
}
person2.valueOf = function () {
  return 1
}
console.log(person == person2) // false 

console.log(person.constructor) // ƒ Person
console.log(person2.constructor) // ƒ Person

console.log(person > person2)